﻿using System;

namespace AiFrame.InterfaceLib.MVP
{
    /// <summary>
    /// Specifies the argument parameters for
    /// the ActiveWindowChanged event.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ActiveWindowChangedParams<T>: EventArgs
    {
        public T Window { get; set; }

        public ActiveWindowChangedParams(T window)
        {
            this.Window = window;
        }
    }

    /// <summary>
    /// Represents a window manager with shortcut functionality.
    /// </summary>
    public interface IWindowManager<T>: IShortCuts
    {
        /// <summary>
        /// Registeres a new window.
        /// </summary>
        /// <param name="window">The window</param>
        void RegisterWindow(T window);

        /// <summary>
        /// Closes a window and disposes it resources.
        /// </summary>
        /// <param name="window">The window</param>
        void CloseWindow(T window);

        /// <summary>
        /// Specifies if a window with the given type exists already.
        /// </summary>
        /// <typeparam name="W">Type of the window.</typeparam>
        /// <returns>True, if the window exists already. False, otherwise.</returns>
        bool ExistsWindow<W>();

        /// <summary>
        /// Shows the window or brings it to front.
        /// </summary>
        /// <typeparam name="W">The type of the window.</typeparam>
        void BringWindowToFront<W>();

        /// <summary>
        /// Returns the active window.
        /// </summary>
        T ActiveWindow { get; }

        /// <summary>
        /// This event is fired when an other window has been activated.
        /// </summary>
        event EventHandler<ActiveWindowChangedParams<T>> ActiveWindowChanged;

        /// <summary>
        /// This event is fired befor an other window is activated.
        /// </summary>
        event EventHandler<ActiveWindowChangedParams<T>> ActiveWindowChanges;
    }
}